#include <stdio.h>

void find_two_largest(int a[], int n, int *largest, int *second_largest);

int main(void)
{
    int n = 5, a[n], j, k;

    printf("Please input %d numbers: \n", n);
    for (int i = 0; i < n; i++)
        scanf(" %d", &a[i]);

    find_two_largest(a, n, &j, &k);
    printf("%d\n", j);
    printf("%d\n", k);

    return 0;
}

void find_two_largest(int a[], int n, int *largest, int *second_largest)
{
    *largest = a[0];
    *second_largest = a[1];

    for (int i = 0; i < n; i++)
    {
        if (a[i] > *largest)
        {
            *second_largest = *largest;
            *largest = a[i];
        }
        if (a[i] > *second_largest && a[i] != *largest)
            *second_largest = a[i];
    }
}